<template>
  <el-card class="app-container">
    <c-u-r-d-table :option="option"/>
  </el-card>
</template>

<script>

import ColumnType from '@/framework/constant/ColumnType'
import OnlineStatusEnum from '@/framework/constant/OnlineStatusEnum'
import {bannerApi} from '@/feature/cms/infra/api/bannerApi'
import CURDTable from '@/framework/components/table/CURDTable'
import BannerPosEnum from "@/feature/cms/infra/constants/BannerPosEnum";
import BannerPosEnEnum from "@/feature/cms/infra/constants/BannerPosEnEnum";

export default {
  components: {CURDTable},
  data() {
    return {
      option: {
        requestApi: bannerApi,
        showSelection: true,
        initListParams: () => {
          return {
            bannerPosSep: this.$route.meta.lang === 'en' ? BannerPosEnEnum.EN_HOME.id : -BannerPosEnEnum.EN_HOME.id
          }
        },
        columns: [
          {
            label: '标题',
            searchable: true,
            width: 'auto',
            required: true,
            prop: 'title'
          },
          {
            label: '类型',
            searchable: true,
            width: 100,
            required: true,
            prop: 'bannerPos',
            type: ColumnType.SELECT,
            options: this.$route.meta.lang === 'en' ? BannerPosEnEnum : BannerPosEnum
          },
          {
            label: '图片路径',
            prop: 'imgSrc',
            required: true,
            type: ColumnType.IMAGE
          },
          {
            label: '链接地址',
            required: false,
            prop: 'link',
            span: 24,
            type: ColumnType.TEXTAREA
          },
          {
            label: '状态',
            searchable: true,
            type: ColumnType.RADIO,
            hiddenInForm: true,
            options: OnlineStatusEnum,
            prop: 'status'
          },
          {
            label: '排序',
            required: true,
            prop: 'sortNum',
            defaultValue: 0,
            type: ColumnType.NUMBER
          },
          {
            label: '创建时间',
            type: ColumnType.DATETIME,
            hiddenInForm: true,
            prop: 'gmtCreate'
          },
          {
            label: '修改时间',
            type: ColumnType.DATETIME,
            hiddenInForm: true,
            prop: 'gmtModified'
          }
        ]
      }
    }
  },
  methods: {}
}
</script>

